package com.jhy.study2.singleton;


/**
 * @author: robert
 * @description: 基于懒汉模式的线程问题
 * @date: 2021/8/22 16:17
 * @return
 */
//解决方式二：基于类初始化(不允许非构造线程重排序)
public class SingletonClass4 {

    private static class SingletomClass4Holder{  //静态内部类
        private static final  SingletonClass4 INSTANCE = new SingletonClass4();
    }

    private SingletonClass4(){}

    public static SingletonClass4 getInstance(){
        return SingletomClass4Holder.INSTANCE;
    }



}
